package alp.starcode.seller.controller;

import alp.starcode.framework.utils.UploadFileUtil;
import net.coobird.thumbnailator.Thumbnails;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
public class TestController {

    @RequestMapping("test.do")
    public Object test() throws IOException {
        //转换图片格式
        Thumbnails.of("F:\\test.png")
                .size(1280,1024)
                .outputFormat("jpg")
                .toFile("F:\\news.jpg");

        Thumbnails.of("F:\\news.jpg").scale(1f).outputQuality(0.25f).toFile("F:\\news.jpg");

        UploadFileUtil.upload("F:\\news.jpg","news.png",true);
        return "ok";
    }
}
